import java.io.*;
import java.util.Arrays;
import java.util.StringTokenizer;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Lily
 * Date: 2024-11-01
 * Time: 19:27
 */
class Orange
{
    int a; // 酸度
    int b; // 甜度
    Orange(){}

    Orange(int a, int b)
    {
        this.a = a;
        this.b = b;
    }
}

public class test_2 {
    //PrintWriter里面的方法和System.out的使用方法一样
    public static PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
    public static Read in = new Read();

    public static void main(String[] args) throws IOException {

        int n=in.nextInt();
        int k=in.nextInt();
        Orange[] o = new Orange[n];
        for(int i = 0; i < n; i++)
        {
            o[i].a = in.nextInt();

        }
        for(int i = 0; i < n; i++)
        {
            o[i].b = in.nextInt();
        }

        // 排序
        Arrays.sort(o, (x, y) ->
        {
            if(x.b == y.b) return x.a - y.a;
            return y.b - x.b;
        });

        // 提取结果
        long x = 0, y = 0;
        for(int i = 0; i < k; i++)
        {
            x += o[i].a;
            y += o[i].b;
        }

        System.out.println(x + " " + y);
    }
}

//快读模板
class Read {//自定义快读读入
    //字符串裁剪
    StringTokenizer st = new StringTokenizer("");

    //1.字节流System.in->字符流InputStreamReader
    //2.带内存缓冲区的字符流BufferedReader
    BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));


    String next() throws IOException {
        //为什么要while循环，因为可能读取的数据不止一行，有多行就需要多次取
        while (!st.hasMoreTokens()) {
            st = new StringTokenizer(bf.readLine());//先拿一行的数据
        }
        return st.nextToken();//对这一行的数据进行裁剪，拿到第一个数据
    }

    String nextLine() throws IOException {
        return bf.readLine();
    }

    int nextInt() throws IOException {
        return Integer.parseInt(next());
    }

    long nextLong() throws IOException {
        return Long.parseLong(next());
    }

    double nextDouble() throws IOException {
        return Double.parseDouble(next());
    }
}